package com.shisfish.library.Controller;

import java.util.HashMap;
import java.util.Map;

import javax.ws.rs.FormParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;

import com.shisfish.library.Impl.BookAddMessageImpl;
import com.shisfish.library.Model.BookAddMessage;
import com.shisfish.library.Utils.Global.GlobalVariable;
import com.shisfish.library.Utils.Global.toJsonUtils;

@Path("bookAddMessage")
public class BookAddMessageController extends GlobalVariable {

	@POST
	@Path("insertOne/{idadmin}")
	@Produces("application/json; charset=utf-8")
	public String insertOne(@PathParam("idadmin") String idadmin, @FormParam("isbn") String isbn, 
			@FormParam("remark") String remark) {
		Map<String, Object> globalMap = new HashMap<String, Object>();
		BookAddMessage bookAddMessage = new BookAddMessage(idadmin, isbn, remark);
		
		int flag = new BookAddMessageImpl().insertOne(bookAddMessage);
		
		System.out.println(flag);
		
		return toJsonUtils.map2Json(globalMap);
	}
	
}
